﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Style" elementFormDefault="qualified" xmlns="Styles.xsd" attributeFormDefault="unqualified" xmlns:mstns="Styles.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="Styles.xsd">
  <xs:element name="Style">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Meta" type="mstns:StyleInfo" minOccurs="1" maxOccurs="1" />
        <xs:element name="Settings" type="mstns:StyleSettings" minOccurs="1" maxOccurs="1" />
        <xs:element name="Window" type="mstns:UIWindow" minOccurs="1" maxOccurs="1" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="StyleSettings" >
    <xs:sequence>
      <xs:element name="StyleFolder" type="xs:string" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIWindow">
    <xs:sequence>
      <xs:element name="DrawingMode" type="mstns:DrawingMode" minOccurs="1" maxOccurs="1" />
      <xs:element name="BackgroundColorStart" type="mstns:ARGB" minOccurs="1" maxOccurs="1" />
      <xs:element name="BackgroundColorEnd" type="mstns:ARGB" minOccurs="0" maxOccurs="1" />      
      <xs:element name="Gradient" type="mstns:GradientStyle" minOccurs="0" maxOccurs="1" />
      <xs:element name="Border" type="BorderStyle" minOccurs="1" maxOccurs="1" /> 
      <xs:element name="Height" type="xs:double" minOccurs="1" maxOccurs="1" />
      <xs:element name="Width" type="xs:double" minOccurs="1" maxOccurs="1" />
      <xs:element name="Elements" type="mstns:UIWindowElements" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIWindowElements">
    <xs:sequence>
      <xs:element name="UserPicture" type="mstns:UIElementImage" minOccurs="1" maxOccurs="1" />
      <xs:element name="UserComputerName" type="mstns:UIElement" />
      <xs:element name="SearchPicture" type="mstns:UIElementImage" minOccurs="1" maxOccurs="1" />
      <xs:element name="Search" type="mstns:UIElement" minOccurs="1" maxOccurs="1" />
      <xs:element name="Searchbox" type="mstns:UIElement" minOccurs="1" maxOccurs="1" />
      <xs:element name="RegionsPosition" type="mstns:UIElementRegionPosition" minOccurs="1" maxOccurs="1" />
      <xs:element name="AllRegions" type="mstns:UIElementRegion" minOccurs="1" maxOccurs="1" />
      <xs:element name="Regions" type="mstns:DictRegions" minOccurs="0" maxOccurs="1" />
      <xs:element name="AllCategories" type="mstns:UIElementCategory" minOccurs="1" maxOccurs="1" />
      <xs:element name="Categories" type="mstns:DictCategories" minOccurs="1" maxOccurs="1" />
      <xs:element name="Regionbuttons" type="mstns:UIRegionButtons" minOccurs="0" maxOccurs="1" />      
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIElementImage">
    <xs:sequence>
      <xs:element name="Height" type="xs:integer" />
      <xs:element name="Width" type="xs:integer" />
      <xs:element name="Source" type="xs:string" />
      <xs:element name="Stretch" type="mstns:Stretch" default="Uniform" />
      <xs:element name="Stretchdirection" type="mstns:StretchDirection" default="Both" />
      <xs:element name="Margin" type="mstns:Margin" minOccurs="0" maxOccurs="1" />
      <xs:element name="Visibility" type="mstns:Visibility" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIElement">
    <xs:sequence>
      <xs:element name="Border" type="mstns:BorderStyle" minOccurs="0" maxOccurs="1" />
      <xs:element name="Padding" type="mstns:Padding" minOccurs="0" maxOccurs="1" />
      <xs:element name="Margin" type="mstns:Margin" minOccurs="0" maxOccurs="1" />
      <xs:element name="BackgroundColor" type="mstns:ARGB" minOccurs="0" maxOccurs="1" />
      <xs:element name="FontFamily" type="xs:string" maxOccurs="1" />
      <xs:element name="FontSize" type="xs:double" maxOccurs="1" />
      <xs:element name="FontColor" type="mstns:RGB" maxOccurs="1" />
      <xs:element name="FontStyle" type="mstns:FontStyle" maxOccurs="1" />
      <xs:element name="FontWeight" type="mstns:FontWeight" maxOccurs="1" />
      <xs:element name="HorizontalAlign" type="mstns:HorizontalAlign" maxOccurs="1" />
      <xs:element name="VerticalAlign" type="mstns:VerticalAlign" maxOccurs="1" />
      <xs:element name="Height" type="xs:double" minOccurs="0" maxOccurs="1" />
      <xs:element name="Width" type="xs:double" minOccurs="0" maxOccurs="1" />
      <xs:element name="Visibility" type="mstns:Visibility" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIElementRegionPosition">
    <xs:sequence>
      <xs:element name="Height" type="xs:double" minOccurs="1" maxOccurs="1" />
      <xs:element name="Margin" type="mstns:Margin" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIElementHeader">
    <xs:complexContent>
      <xs:extension base="mstns:UIElement" >
        <xs:sequence>          
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="UIElementData">
    <xs:complexContent>
      <xs:extension base="mstns:UIElement" >
        <xs:sequence>
          <xs:element name="LineHeight" type="xs:double" minOccurs="1" maxOccurs="1" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="UIElementRegion">
    <xs:sequence>
      <xs:element name="BackgroundColor" type="mstns:ARGB" minOccurs="0" maxOccurs="1" />
      <xs:element name="Header" type="mstns:UIElementHeader" minOccurs="0" maxOccurs="1" />
      <xs:element name="Data" type="mstns:UIElementData" minOccurs="1" maxOccurs="1" />
      <xs:element name="Name" type="xs:string" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIElementRegionButton">
    <xs:sequence>
      <xs:element name="Width" type="xs:integer" maxOccurs="1" default="80" />
      <xs:element name="Image" type="mstns:UIElementImage" minOccurs="0" maxOccurs="1" />
      <xs:element name="Label" type="mstns:UIElement" minOccurs="1" maxOccurs="1" />
      <xs:element name="Region" type="xs:string" maxOccurs="1" default="" />
      <xs:element name="Visibility" type="mstns:Visibility" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIRegionButtons">
    <xs:sequence>
      <xs:element name="Height" type="xs:integer" maxOccurs="1" default="80" />
      <xs:element name="Margin" type="mstns:Margin" minOccurs="1" maxOccurs="1" />
      <xs:element name="Selector" type="mstns:UIElementImage" minOccurs="1" maxOccurs="1" />
      <xs:element name="SelectPrevious" type="mstns:UIElementImage" minOccurs="1" maxOccurs="1" />
      <xs:element name="SelectNext" type="mstns:UIElementImage" minOccurs="1" maxOccurs="1" />
      <xs:element name="RegionButton" type="mstns:UIElementRegionButton" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="UIElementCategory">
    <xs:complexContent>
      <xs:extension base="mstns:UIElementRegion">
        <xs:sequence>          
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="DictRegions">
    <xs:sequence>
      <xs:element name="Region" type="mstns:UIElementRegion" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="DictCategories">
    <xs:sequence>
      <xs:element name="Category" type="mstns:UIElementCategory" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="StyleInfo">
    <xs:sequence>
      <xs:element name="Date" type="xs:date" minOccurs="1" maxOccurs="1" />
      <xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="Description" type="xs:string"  minOccurs="1" maxOccurs="1" />
      <xs:element name="Version" type="xs:integer"  minOccurs="1" maxOccurs="1" />
      <xs:element name="Author" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="Mail" type="emailAddress" minOccurs="1" maxOccurs="1" />
      <xs:element name="Web" type="xs:anyURI" minOccurs="0" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="GradientStyle">
    <xs:sequence>
      <xs:element name="Angle" type="xs:double" />
      <xs:element name="Offset" type="xs:double" />
    </xs:sequence>
  </xs:complexType>  
  <xs:simpleType name="RGBColorPart">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0" />
      <xs:maxInclusive value="255" />
    </xs:restriction>
  </xs:simpleType>
  <xs:complexType name="ARGB">
    <xs:sequence>
      <xs:element name="Alpha" type="mstns:RGBColorPart" />
      <xs:element name="Red" type="mstns:RGBColorPart" />
      <xs:element name="Green" type="mstns:RGBColorPart" />
      <xs:element name="Blue" type="mstns:RGBColorPart" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="RGB">
    <xs:sequence>
      <xs:element name="Red" type="mstns:RGBColorPart" />
      <xs:element name="Green" type="mstns:RGBColorPart" />
      <xs:element name="Blue" type="mstns:RGBColorPart" />
    </xs:sequence>
  </xs:complexType>  
  <xs:complexType name="BorderStyle">
    <xs:sequence>
      <xs:element name="Width" type="xs:integer" />
      <xs:element name="Color" type="mstns:RGB" />
      <xs:element name="Visible" type="xs:boolean"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Margin">
    <xs:sequence>
      <xs:element name="Top" type="xs:integer" />
      <xs:element name="Right" type="xs:integer" />
      <xs:element name="Bottom" type="xs:integer" />
      <xs:element name="Left" type="xs:integer" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Padding">
    <xs:sequence>
      <xs:element name="Top" type="xs:integer" />
      <xs:element name="Right" type="xs:integer" />
      <xs:element name="Bottom" type="xs:integer" />
      <xs:element name="Left" type="xs:integer" />      
    </xs:sequence>
  </xs:complexType>
  <xs:simpleType name="HorizontalAlign">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Left" />
      <xs:enumeration value="Center" />
      <xs:enumeration value="Right" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="VerticalAlign">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Top" />
      <xs:enumeration value="Center" />
      <xs:enumeration value="Bottom" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="Stretch">
      <xs:restriction base="xs:string">
        <xs:enumeration value="None" />
        <xs:enumeration value="Fill" />
        <xs:enumeration value="Uniform" />
        <xs:enumeration value="UniformToFill" />
      </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="StretchDirection">
    <xs:restriction base="xs:string">
      <xs:enumeration value="UpOnly" />
      <xs:enumeration value="DownOnly" />
      <xs:enumeration value="Both" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="FontStyle">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Italic" />
      <xs:enumeration value="Normal" />
      <xs:enumeration value="Oblique" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="FontWeight">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Thin" />
      <xs:enumeration value="ExtraLight" />
      <xs:enumeration value="Light" />
      <xs:enumeration value="Normal" />
      <xs:enumeration value="Medium" />
      <xs:enumeration value="SemiBold" />
      <xs:enumeration value="Bold" />
      <xs:enumeration value="ExtraBold"/>
      <xs:enumeration value="Black" />
      <xs:enumeration value="ExtraBlack" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="DrawingMode">
    <xs:restriction base="xs:string">
      <xs:enumeration value="SingleColor" />
      <xs:enumeration value="Gradient" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="Visibility">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Visible" />
      <xs:enumeration value="Hidden" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="emailAddress">
    <xs:restriction base="xs:string">
      <xs:pattern value="[^@]+@[^\.]+\..+"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
